<%@ page contentType="text/html;charset=UTF-8"%>
<html>
<head>
<%--<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />--%>
<meta name="layout" content="main" />

<title>Insert title here</title>
</head>
<body>

	<div align="center">
		<h1>
			${frage.gestellteFrage }
		</h1>
			<h6>${frage.dateCreated }</h6>

	</div>

	<sec:ifLoggedIn>
		<div class="body">
			Alle/neue Antworte
			<g:formRemote name="subForm"
				url="[controller:'antwort', action:'save']" update="mainContent">
				<g:hiddenField name="speichern" value="true" />
				<g:hiddenField name="version" value="${frage?.version}" />
				<div
					class="fieldcontain ${hasErrors(bean: antwortInstance, field: 'antwort', 'error')} ">
					<label for="antwort"> antwort</label>
					<g:textArea name="antwort" value="${antwortInstance?.antwort}" />
				</div>

				<div
					class="fieldcontain ${hasErrors(bean: antwortInstance, field: 'benutzer', 'error')} required">
					<label for="benutzer"> </label>
					<%--					<g:select id="benutzer" name="benutzer.id"--%>
					<%--						from="${forum.Benutzer.list()}" optionKey="id" required=""--%>
					<%--						value="${antwortInstance?.benutzer?.id}" class="many-to-one" />--%>
					<g:hiddenField name="benutzer" id="benutzer" value="${user?.id }" />
				</div>

				<div
					class="fieldcontain ${hasErrors(bean: antwortInstance, field: 'frage', 'error')} required">
					<label for="frage"> </label>
					<%--					<g:select id="frage" name="frage.id" from="${forum.Frage.list()}"--%>
					<%--						optionKey="id" required="" value="${antwortInstance?.frage?.id}"--%>
					<%--						class="many-to-one" />--%>
					<g:hiddenField name="frage" value="${frage?.id}" />
				</div>
				<g:submitButton name="save" />
			</g:formRemote>

		</div>
	</sec:ifLoggedIn>
	<div id="mainContent">
		<g:each in="${ant }" var="a">
			<li><a href="#">
					<h3>
						${a.benutzer }
					</h3>
			</a> ${a.antwort }</li>
			<h6>${a.dateCreated }</h6>
		</g:each>
	</div>
	</div>
</body>
</html>